<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>点亮灯泡</title>
</head>
<body>

<script>
    function changeImage() {
        element = document.getElementById("myimage");
        if (element.src.match("bulbon")){
            element.src = "../img/pic_bulboff.gif";
        } else {
            element.src ="../img/pic_bulbon.gif";
        }
    }
</script>

<img id="myimage" onclick="changeImage()" src="../img/pic_bulboff.gif" width="100" height="180">
</body>
</html>